package com.stone.serverless.registry.controller;

import com.stone.serverless.registry.DiscoveryService;
import com.stone.serverless.registry.domain.ServiceInstance;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @Description: TODO
 * @Author: MECHREVO
 * @Date: 2022/1/24 18:08
 * @Version: 1.0.0
 */
@Controller
@RequestMapping("discovery")
public class DiscoveryController {

    @Autowired
    private DiscoveryService discoveryService;


    @GetMapping(value = "/get")
    @ResponseBody
    public List<ServiceInstance> get(@RequestParam String serviceName) {
        return discoveryService.getAllService(serviceName);
    }
}
